use crypto::digest::Digest;

fn main() {
    let mut hash256_tool = crypto::sha3::Sha3::sha3_512();
    let mut hash1_tool = crypto::sha1::Sha1::new();
    let src_body="test1";
    hash256_tool.input_str(src_body);
    let output_hash=hash256_tool.result_str();
    hash1_tool.input_str(src_body);
    let output_sha1=hash1_tool.result_str();
    println!("src:{}\n encode_512:{}\n sha1：{}",src_body,output_hash,output_sha1);

    let seed_test= [0x26, 0x27, 0xf6, 0x85, 0x67, 0x15, 0xad, 0x1d, 0xd2, 0x94, 0xdd, 0xc4, 0x76, 0x19, 0x39, 0x31,
        0xf1, 0xad, 0xb5, 0x58, 0xf0, 0x93, 0x97, 0x32, 0x19, 0x2b, 0xd1, 0xc0, 0xfd, 0x16, 0x8e, 0x4e];
    ;
    let (key_pri,key_pub)=crypto::ed25519::keypair(&seed_test);

    println!("pri:{:?}\n pub : {:?}\n",key_pri.to_vec(),key_pub.to_vec());

    let msg_test="dsadasdada".as_bytes();
    let sign_test = crypto::ed25519::signature(msg_test,&key_pri);

    let check =crypto::ed25519::verify(msg_test,&key_pub,&sign_test);
    println!("msg:{:?},\nsign:{:?},\ncheck:{:?}",msg_test,sign_test.to_vec(),check);

    let seed_test1= [0x23, 0x27, 0xf6, 0x85, 0x67, 0x15, 0xad, 0x1d, 0xd2, 0x94, 0xdd, 0xc4, 0x76, 0x19, 0x39, 0x31,
        0xf1, 0xad, 0xb5, 0x58, 0xf0, 0x93, 0x97, 0x32, 0x19, 0x2b, 0xd1, 0xc0, 0xfd, 0x16, 0x8e, 0x4e];
    ;
    let seed_test2= [0x26, 0x27, 0xf6, 0x85, 0x67, 0x15, 0xad, 0x1d, 0xd2, 0x94, 0xdd, 0xc4, 0x76, 0x19, 0x39, 0x31,
        0xf1, 0xad, 0xb5, 0x58, 0x02, 0x93, 0x97, 0x32, 0x19, 0x2b, 0xd1, 0xc0, 0xfd, 0x16, 0x8e, 0x4e];
    ;

    let a_key= crypto::curve25519::curve25519_base(seed_test1.as_ref());
    let b_key= crypto::curve25519::curve25519_base(seed_test2.as_ref());
    let (key_pri_A,key_pub_A)=crypto::ed25519::keypair(a_key.as_ref());

    let (key_pri_B,key_pub_B)=crypto::ed25519::keypair(&b_key.as_ref());

    // let a_Fe = crypto::curve25519::;

    println!("akey：{:?}\nbkey:{:?}",key_pri_A.as_ref(),key_pri_B.as_ref());

    let keyPark=crypto::curve25519::curve25519(key_pri_A.as_ref(),key_pub_A.as_ref());



    println!("retKeyPark:{:?}\n keySeed:{:?}",keyPark.as_ref(),a_key.as_ref());

}
